import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '客户编码',
    align:"center",
    dataIndex: 'code'
   },
   {
    title: '客户名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '客户简称',
    align:"center",
    dataIndex: 'shortname'
   },
   {
    title: '助记码',
    align:"center",
    dataIndex: 'mnecode'
   },
   {
    title: '客户基本分类',
    align:"center",
    dataIndex: 'pkCustclass'
   },
   {
    title: '客户状态',
    align:"center",
    dataIndex: 'custstate',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}])
     },
   },
   {
    title: '纳税人登记号',
    align:"center",
    dataIndex: 'taxpayerid'
   },
   {
    title: '删除标识',
    align:"center",
    dataIndex: 'dr'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "客户编码",
      field: 'code',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "客户名称",
      field: 'name',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "客户简称",
      field: 'shortname',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "助记码",
      field: 'mnecode',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "客户基本分类",
      field: 'pkCustclass',
    component: 'JPopup',
    componentProps: ({ formActionType }) => {
        const {setFieldsValue} = formActionType;
        return{
            setFieldsValue:setFieldsValue,
            code:"",
            fieldConfig: [
                { source: '', target: '' },
            ],
            multi:true
        }
    },

      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '创建人',
    field: 'createBy',
    component: 'Input',
    dynamicDisabled:true,
    show: false
  },
  {
    label: '客户编码',
    field: 'code',
    component: 'Input',
  },
  {
    label: '客户名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '客户简称',
    field: 'shortname',
    component: 'Input',
  },
  {
    label: '助记码',
    field: 'mnecode',
    component: 'Input',
  },
  {
    label: '客户基本分类',
    field: 'pkCustclass',
    component: 'JPopup',
    componentProps: ({ formActionType }) => {
        const {setFieldsValue} = formActionType;
        return{
            setFieldsValue:setFieldsValue,
            code:"",
            fieldConfig: [
                { source: '', target: '' },
            ],
            multi:true
        }
    },

  },
  {
    label: '客户状态',
    field: 'custstate',
     component: 'JSwitch',
     componentProps:{
     },
  },
  {
    label: '纳税人登记号',
    field: 'taxpayerid',
    component: 'Input',
  },
  {
    label: '删除标识',
    field: 'dr',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表列表数据
export const bdCustbankColumns: BasicColumn[] = [
   {
    title: '账号',
    align:"center",
    dataIndex: 'accnum'
   },
   {
    title: '户名',
    align:"center",
    dataIndex: 'accname'
   },
   {
    title: '银行类别',
    align:"center",
    dataIndex: 'banktype',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}])
     },
   },
   {
    title: '账户状态',
    align:"center",
    dataIndex: 'accstate'
   },
   {
    title: '联行号',
    align:"center",
    dataIndex: 'combinenum'
   },
   {
    title: '机构号/分行号',
    align:"center",
    dataIndex: 'orgnumber'
   },
   {
    title: '客户基本信息',
    align:"center",
    dataIndex: 'idH'
   },
   {
    title: '删除标识',
    align:"center",
    dataIndex: 'dr'
   },
];
//子表表格配置
export const bdCustbankJVxeColumns: JVxeColumn[] = [
    {
      title: '账号',
      key: 'accnum',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '户名',
      key: 'accname',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '银行类别',
      key: 'banktype',
      type: JVxeTypes.checkbox,
      customValue: ['Y', 'N'],
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '账户状态',
      key: 'accstate',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '联行号',
      key: 'combinenum',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '机构号/分行号',
      key: 'orgnumber',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '客户基本信息',
      key: 'idH',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '删除标识',
      key: 'dr',
      type: JVxeTypes.inputNumber,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]

// 高级查询数据
export const superQuerySchema = {
  code: {title: '客户编码',order: 1,view: 'text', type: 'string',},
  name: {title: '客户名称',order: 2,view: 'text', type: 'string',},
  shortname: {title: '客户简称',order: 3,view: 'text', type: 'string',},
  mnecode: {title: '助记码',order: 4,view: 'text', type: 'string',},
  pkCustclass: {title: '客户基本分类',order: 5,view: 'popup', type: 'string',code: '', orgFields: '', destFields: 'pkCustclass', popupMulti: false,},
  custstate: {title: '客户状态',order: 6,view: 'switch', type: 'string',},
  taxpayerid: {title: '纳税人登记号',order: 7,view: 'text', type: 'string',},
  dr: {title: '删除标识',order: 8,view: 'number', type: 'number',},
  //子表高级查询
  bdCustbank: {
    title: '客户银行帐号',
    view: 'table',
    fields: {
        accnum: {title: '账号',order: 0,view: 'text', type: 'string',},
        accname: {title: '户名',order: 1,view: 'text', type: 'string',},
        banktype: {title: '银行类别',order: 2,view: 'switch', type: 'string',},
        accstate: {title: '账户状态',order: 3,view: 'text', type: 'string',},
        combinenum: {title: '联行号',order: 4,view: 'text', type: 'string',},
        orgnumber: {title: '机构号/分行号',order: 5,view: 'text', type: 'string',},
        idH: {title: '客户基本信息',order: 6,view: 'text', type: 'string',},
        dr: {title: '删除标识',order: 7,view: 'number', type: 'number',},
    }
  },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
